package ru.amse.tsyganov.jumleditor.view.preferences;

import org.eclipse.swt.graphics.Image;

public class Images {
	
	private static Image errorImage;
	
	private static Image warningImage;
	
	private static Image undoEditImage;
	
	private static Image redoEditImage;
	
	private static Image selectImage;
	
	private static Image selectImageSelected;
	
	private static Image activityImage;
	
	private static Image activityImageSelected;
	
	private static Image initialStateImage;
	
	private static Image initialStateImageSelected;
	
	private static Image finalStateImage;
	
	private static Image finalStateImageSelected;
	
	private static Image joinStateImage;
	
	private static Image joinStateImageSelected;
	
	private static Image decisionForkImage;
	
	private static Image decisionForkImageSelected;
	
	private static Image decisionJoinImage;
	
	private static Image decisionJoinImageSelected;
	
	private static Image transitionImage;
	
	private static Image transitionImageSelected;
	
	private static Image communicationImage;
	
	private static Image communicationImageSelected;
	
	private static Image actorImage;
	
	private static Image actorImageSelected;
	
	private static Image instanceImage;
	
	private static Image instanceImageSelected;
	
	private static Image checkedImage;
	
	private static Image uncheckedImage;
	
	private static Image activityChartImage;
	
	private static Image collaborationChartImage;
	
	public static Image getErrorImage() {
		if (errorImage == null) {
			errorImage = new Image(null, "icons/error.gif");
			//errorImage = new Image(null, ClassLoader.getSystemResourceAsStream("icons/error.gif"));
		}
		return errorImage;
	}
	
	public static Image getWarningImage() {
		if (warningImage == null) {
			warningImage = new Image(null, "icons/warning.gif");
		}
		return warningImage;
	}
	
	public static Image getUndoEditImage() {
		if (undoEditImage == null) {
			undoEditImage = new Image(null, "icons/undo_edit.gif");
		}
		return undoEditImage;
	}
	
	public static Image getRedoEditImage() {
		if (redoEditImage == null) {
			redoEditImage = new Image(null, "icons/redo_edit.gif");
		}
		return redoEditImage;
	}
	
	public static Image getSelectImage() {
		if (selectImage == null) {
			selectImage = new Image(null, "icons/select.png");
		}
		return selectImage;
	}
	
	public static Image getSelectImageSelected() {
		if (selectImageSelected == null) {
			selectImageSelected = new Image(null, "icons/select_s.png");
		}
		return selectImageSelected;
	}
	
	public static Image getActivityImage() {
		if (activityImage == null) {
			activityImage = new Image(null, "icons/activity.gif");
		}
		return activityImage;
	}
	
	public static Image getActivityImageSelected() {
		if (activityImageSelected == null) {
			activityImageSelected = new Image(null, "icons/activity_s.gif");
		}
		return activityImageSelected;
	}
	
	public static Image getInitialStateImage() {
		if (initialStateImage == null) {
			initialStateImage = new Image(null, "icons/initialState.gif");
		}
		return initialStateImage;
	}
	
	public static Image getInitialStateImageSelected() {
		if (initialStateImageSelected == null) {
			initialStateImageSelected = new Image(null, "icons/initialState_s.gif");
		}
		return initialStateImageSelected;
	}
	
	public static Image getFinalStateImage() {
		if (finalStateImage == null) {
			finalStateImage = new Image(null, "icons/finalState.gif");
		}
		return finalStateImage;
	}
	
	public static Image getFinalStateImageSelected() {
		if (finalStateImageSelected == null) {
			finalStateImageSelected = new Image(null, "icons/finalState_s.gif");
		}
		return finalStateImageSelected;
	}
	
	public static Image getJoinImage() {
		if (joinStateImage == null) {
			joinStateImage = new Image(null, "icons/join.gif");
		}
		return joinStateImage;
	}
	
	public static Image getJoinImageSelected() {
		if (joinStateImageSelected == null) {
			joinStateImageSelected = new Image(null, "icons/join_s.gif");
		}
		return joinStateImageSelected;
	}
	
	public static Image getDecisionForkImage() {
		if (decisionForkImage == null) {
			decisionForkImage = new Image(null, "icons/decision.gif");
		}
		return decisionForkImage;
	}
	
	public static Image getDecisionForkImageSelected() {
		if (decisionForkImageSelected == null) {
			decisionForkImageSelected = new Image(null, "icons/decision_s.gif");
		}
		return decisionForkImageSelected;
	}
	
	public static Image getDecisionJoinImage() {
		if (decisionJoinImage == null) {
			decisionJoinImage = new Image(null, "icons/decision_join.gif");
		}
		return decisionJoinImage;
	}
	
	public static Image getDecisionJoinImageSelected() {
		if (decisionJoinImageSelected == null) {
			decisionJoinImageSelected = new Image(null, "icons/decision_join_s.gif");
		}
		return decisionJoinImageSelected;
	}
	
	public static Image getTransitionImage() {
		if (transitionImage == null) {
			transitionImage = new Image(null, "icons/transition.gif");
		}
		return transitionImage;
	}
	
	public static Image getTransitionImageSelected() {
		if (transitionImageSelected == null) {
			transitionImageSelected = new Image(null, "icons/transition_s.gif");
		}
		return transitionImageSelected;
	}
	
	public static Image getActorImage() {
		if (actorImage == null) {
			actorImage = new Image(null, "icons/actor.gif");
		}
		return actorImage;
	}
	
	public static Image getActorImageSelected() {
		if (actorImageSelected == null) {
			actorImageSelected = new Image(null, "icons/actor_s.gif");
		}
		return actorImageSelected;
	}
	
	public static Image getInstanceImage() {
		if (instanceImage == null) {
			instanceImage = new Image(null, "icons/instance.gif");
		}
		return instanceImage;
	}
	
	public static Image getInstanceImageSelected() {
		if (instanceImageSelected == null) {
			instanceImageSelected = new Image(null, "icons/instance_s.gif");
		}
		return instanceImageSelected;
	}
	
	public static Image getCommunicationImage() {
		if (communicationImage == null) {
			communicationImage = new Image(null, "icons/communication.gif");
		}
		return communicationImage;
	}
	
	public static Image getCommunicationImageSelected() {
		if (communicationImageSelected == null) {
			communicationImageSelected = new Image(null, "icons/communication_s.gif");
		}
		return communicationImageSelected;
	}
	
	public static Image getCheckedImage() {
		if (checkedImage == null) {
			checkedImage = new Image(null, "icons/checked.gif");
		}
		return checkedImage;
	}
	
	public static Image getUncheckedImage() {
		if (uncheckedImage == null) {
			uncheckedImage = new Image(null, "icons/unchecked.gif");
		}
		return uncheckedImage;
	}
	
	public static Image getActivityChartImage() {
		if (activityChartImage == null) {
			activityChartImage = new Image(null, "icons/activityDiagram_on.gif");
		}
		return activityChartImage;
	}
	
	public static Image getCollaborationChartImage() {
		if (collaborationChartImage == null) {
			collaborationChartImage = new Image(null, "icons/collaborationDiagram_on.gif");
		}
		return collaborationChartImage;
	}
	
	public static void dispose() {
		if (errorImage == null) {
			errorImage.dispose();
		}
		
		if (warningImage == null) {
			warningImage.dispose();
		}
		
		if (undoEditImage == null) {
			undoEditImage.dispose();
		}
		
		if (redoEditImage == null) {
			redoEditImage.dispose();
		}
		
		if (selectImage == null) {
			selectImage.dispose();
		}
		
		if (selectImageSelected == null) {
			selectImageSelected.dispose();
		}
		
		if (activityImage == null) {
			activityImage.dispose();
		}
		
		if (initialStateImage == null) {
			initialStateImage.dispose();
		}
		
		if (finalStateImage == null) {
			finalStateImage.dispose();
		}
		
		if (joinStateImage == null) {
			joinStateImage.dispose();
		}
		
		if (decisionForkImage == null) {
			decisionForkImage.dispose();
		}
		
		if (decisionJoinImage == null) {
			decisionJoinImage.dispose();
		}
		
		if (transitionImage == null) {
			transitionImage.dispose();
		}
		
		if (activityImageSelected == null) {
			activityImageSelected.dispose();
		}
		
		if (initialStateImageSelected == null) {
			initialStateImageSelected.dispose();
		}
		
		if (finalStateImageSelected == null) {
			finalStateImageSelected.dispose();
		}
		
		if (joinStateImageSelected == null) {
			joinStateImageSelected.dispose();
		}
		
		if (decisionForkImageSelected == null) {
			decisionForkImageSelected.dispose();
		}
		
		if (decisionJoinImageSelected == null) {
			decisionJoinImageSelected.dispose();
		}
		
		if (transitionImageSelected == null) {
			transitionImageSelected.dispose();
		}
		
		if (actorImageSelected == null) {
			actorImageSelected.dispose();
		}
		
		if (actorImage == null) {
			actorImage.dispose();
		}
		
		if (instanceImageSelected == null) {
			instanceImageSelected.dispose();
		}
		
		if (instanceImage == null) {
			instanceImage.dispose();
		}
		
		if (communicationImageSelected == null) {
			communicationImageSelected.dispose();
		}
		
		if (communicationImage == null) {
			communicationImage.dispose();
		}
		
		if (checkedImage == null) {
			checkedImage.dispose();
		}
		
		if (uncheckedImage == null) {
			uncheckedImage.dispose();
		}
		
		if (activityChartImage == null) {
			activityChartImage.dispose();
		}
		
		if (collaborationChartImage == null) {
			collaborationChartImage.dispose();
		}
	}
}
